package com.itheima;

public class students {
    private String name;
    private int years;

    //get/set方法
    public void Getname(String name) {
        //this修饰成员变量。解决成员变量，被局部变量覆盖问题
        this.name = name;
    }

    public String setName() {
        return name;
    }

    public void Getyears(int a) {
        years = a;
    }

    public int Setyears() {
        return years;
    }
    //构造方法
    //在studnts_demo中被调用直接触发
    public students(){
        System.out.println("无参构造方法");
    }

    public void show() {
        System.out.println(years + "---" + name);
    }
}
